<?php

namespace App\Http\Requests\Api;

class CaptchaRequest extends FormRequest{

    public function rules(){
        if(!empty($this->phone)){
            $this->phone = ltrim(phone($this->phone, 'CN', 'E164'), '+86');
        }
        return [
            'phone' => [
                'required',
                'phone:CN,mobile',
                'unique:users'
            ],
        ];
    }
}
